package com.ccsoft.zknote.controller;

import com.ccsoft.zknote.pojo.system.JsonResult;
import com.ccsoft.zknote.service.IMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chanchaw
 * @create 2023-07-11 16:02
 */
@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private IMailService emailService;
//    @PostMapping("/getEmailVC")
//    public JsonResult getEmailVC(@RequestBody Map<String,String> params){
//        String email = params.get("email");
//        String verificationCode = emailService.getVerificationCode(email);
//        return JsonResult.ok(verificationCode);
//    }

    @PostMapping("/getEmailVC")
    public JsonResult getEmailVC(@RequestBody Map<String,String> params){
        String email = params.get("email");
        String verificationCode = emailService.getVerificationCode(email);
        return JsonResult.ok(verificationCode);
    }
}
